package com.cms.recursoshumanos.handler;

import com.cms.recursoshumanos.cache.UserInfoCache;
import com.cms.recursoshumanos.facade.LoginGetInfoUserFacade;
import com.cms.recursoshumanos.facade.LoginUserDetailScreenFacade;
import com.cms.recursoshumanos.facade.MyUserDetailScreenFacade;

public class MyUserDetailScreenHandler extends BaseHandler
{
	public boolean informacion_vacio()
	{
		if(UserInfoCache.getInstance().getEmpleado() == null)
		{
			return true;
		}
		else
		{
			return false;
		}
	}
	public void facadeLoginUserInfo(String username, String password)
	{
		LoginUserDetailScreenFacade facade = new LoginUserDetailScreenFacade(username,password);
		facade.getInfoUser();
	}
	public void facadeUserInfo(String username, String password)
	{
		MyUserDetailScreenFacade facade = new MyUserDetailScreenFacade(username,password);
		facade.getInfoUser();
	}
	public void refreshUserInfo (String username, String password)
	{
		this.facadeUserInfo(username, password);
	}
	
	public void getAllUserInfo(String username,String password)
	{
		if ( (!UserInfoCache.getInstance().cache_utilizable(1)) 
				|| informacion_vacio())
		{
			this.facadeUserInfo(username, password);
		}
		else
		{
			this.goInfoUserScreen();
		}
	}
	
	public void getLoginUserinfo(String username, String password)
	{
		LoginGetInfoUserFacade facade = new LoginGetInfoUserFacade(username, password);
		facade.getInfoUser();
	}
}
